//
//  PLBroadcaster.h
//  Plankton
//
//  Created by Marc Schlichte on 21.07.08.
//  Copyright 2008 Framework Labs. All rights reserved.
//

#import <Cocoa/Cocoa.h>

#import "PLPlatform.h"


@interface PLBroadcaster : NSObject 
{
    NSString        *aid;
    PLPlatform      *platform;
    NSMutableArray  *receivers;
}

- (id)initWithPlatform:(PLPlatform *)platform;

- (void)broadcast:(id)message;

@end

@protocol PLBroadcastReceiverDelegate;

@interface PLBroadcastReceiver : NSObject <PLMessageHandler>
{
    NSString    *ownAid;
    NSString    *broadcasterAid;
    PLPlatform  *platform;
    PLPattern   *receivePattern;
    id<PLBroadcastReceiverDelegate> delegate;
}

- (id)initWithPlatform:(PLPlatform *)platform;

@property(assign) id<PLBroadcastReceiverDelegate> delegate;

- (void)tuneInto:(NSString *)broadcaster;
- (void)tuneOut;

@end

@protocol PLBroadcastReceiverDelegate <NSObject>

- (void)broadcastReceiver:(PLBroadcastReceiver *)receiver receivedMessage:(id)message;

@end